from django.shortcuts import render
from django.http import HttpResponse
from .models import BookInfo


# Create your views here.
def index(request):
    """
    index:视图
    parm request 包含了请求信息的请求对象
    return: 响应对象
    """
    return HttpResponse("hello the world!")


def show_books(request):
    books = BookInfo.objects.all()
    content = {"books": books}
    # context 上下文
    return render(request, "index.html", context=content)